1. /* sdcexp1.cpp by K.Tsuru */
  2. // function ID 3521 DRADIX, constant
  3. /*************************
  4. base of natural logarithm exp(1).
  5. In header "snmath.h" the function prototype is given below
  6. --------
  7. SDouble E(const SDouble* e = NULL, SDouble (*pfCalcFunc)() = SNE);
  8. --------
  9. Remade at version 2.30.
  10. **************************/
  11. #ifndef SN_H
  12. #include "sn.h"
  13. #endif
  14. static SDouble* exp1 = NULL; //keep in the static memory
  15. static uint exp1Size = 0;
  16. uint ESize() { return exp1Size; }
  17. void EFree(){ //free the momory of exp1
  18. if(exp1Size == 0) return;
  19. delete exp1; exp1 = NULL; exp1Size = 0;
  20. }
  21. SDouble E(const SDouble* userE, SDouble (*pfCalcFunc)()){
  22. if(exp1 == NULL) exp1 = new SDouble;
  23. uint curMaxSize = exp1->MaxSize(); // current max size
  24. if( exp1Size < curMaxSize ){
  25. #if UsesSNConstantFile
  26. if(userE == NULL){ //called by default argument
  27. int enough;
  28. /**********************************************************************************
  29. UpdateConstantFile() recursively calls this function E() via SetConstByFile()
  30. of which userE != NULL, then does not come here and processing below has been
  31. done.
  32. **********************************************************************************/
  33. enough = UpdateConstantFile(E_FILE, E, pfCalcFunc, curMaxSize);
  34. if(enough != NO_SNC_FILE) return *exp1;
  35. }
  36. #endif
  37. exp1->ShowMessage("Evaluating E() now.....");
  38. EntryConst(userE, exp1, pfCalcFunc, &exp1Size);
  39. exp1->ShowMessage(" Finished.\n"); // ver. 2.17
  40. exp1Size = curMaxSize;
  41. }
  42. return *exp1;
  43. }

sdcexp1.cpp : last modifiled at 2017/06/24 10:41:10(1,557 bytes)
created at 2017/10/07 10:21:15
The creation time of this html file is 2017/10/07 10:30:03 (Sat Oct 07 10:30:03 2017).